Autosave Trigger

Hi,

I'm working on an autosave feature for DOORS which, every time an attribute was modified, it would increment a counter, and then would save after a specified amount of time, but I'm having trouble understanding exactly how triggers work.  Would there be any way to just start this "AutoSave" program and run it in the background while the DOORS user is making changes, or is this impossible?  And if it is possible, how would I go about doing this?

Thanks!

Josiah


josiah820 - Tue May 21 12:23:54 EDT 2013

Re: Autosave Trigger
llandale - Tue May 21 14:09:12 EDT 2013

Sounds like you are asking about a "post-save-attribute" trigger to notice when an attribute was modified.  Keeping "count" is another matter and may involve clever top-context variable; but I don't do that sort of thing.   You would want to keep a separate count for each module; maybe a top-context "Skip" list; "key" is full module name and "Data" is 'int' count.

There is no "background" saving.  Having a script stop folks abruptly to do a lengthy save would be very annoying to me.

As for auto-saving at regular intervals:

I didn't pay much attention but it seems to me a couple years ago they posted a sotution here, featuring a tiny dialog box with a "timer" DBE.  The callback would fire every whatever 3 seconds, and you could go from there.  If that works you could have a post-module-open trigger that opens the dialog (associated with your module), probably closing the dialog with a dynamic pre-module-close trigger.

You could also have an on-demand Explorer dialog with such a Timer DBE, and every X minutes does something like this:

  • for mod in database do
  • if (unsaved(mod) save(mod)
  • ... or
  • if (isEdit(mod) or (isShare(mod)) then save(mod)   // I had problems with "unsaved(mod)" in the past

-Louie

Re: Autosave Trigger
llandale - Tue May 21 14:14:52 EDT 2013

llandale - Tue May 21 14:09:12 EDT 2013

Sounds like you are asking about a "post-save-attribute" trigger to notice when an attribute was modified.  Keeping "count" is another matter and may involve clever top-context variable; but I don't do that sort of thing.   You would want to keep a separate count for each module; maybe a top-context "Skip" list; "key" is full module name and "Data" is 'int' count.

There is no "background" saving.  Having a script stop folks abruptly to do a lengthy save would be very annoying to me.

As for auto-saving at regular intervals:

I didn't pay much attention but it seems to me a couple years ago they posted a sotution here, featuring a tiny dialog box with a "timer" DBE.  The callback would fire every whatever 3 seconds, and you could go from there.  If that works you could have a post-module-open trigger that opens the dialog (associated with your module), probably closing the dialog with a dynamic pre-module-close trigger.

You could also have an on-demand Explorer dialog with such a Timer DBE, and every X minutes does something like this:

  • for mod in database do
  • if (unsaved(mod) save(mod)
  • ... or
  • if (isEdit(mod) or (isShare(mod)) then save(mod)   // I had problems with "unsaved(mod)" in the past

-Louie

I hate it when I start thinking...

Post-module-Open trigger opens an "Auto-Save" code; which deploys a dyamic post-save-attr trigger.  Also, an on-demand script could do it also. The callback for that code is part of the Dialog context; so a global variable could keep your count.  This may get you going...

  • int UpdateCount = 0
  • int SaveThreshold = 20
  •  
  • void clbkPostSave(Trigger trg)
  • {  if (UpdateCount++ >= SaveThreshold)
  •    {  UpdateCount = 0
  •       save(mod)
  •    }
  • }   // end clbkPostSave()
  •  
  • trigger(module, post, save, 10, clbkPostSave)

-Louie